// menu
$(function(){
	var n=$(".top_menu ul .cur").index()
	$(".top_menu ul li").mouseenter(
		function(){
			var z=$(this).index()
			$(".top_menu i").stop().animate({left:(z*100)},300)
			$(this).addClass("cur")
			$(this).siblings().removeClass("cur")
		}
	)
	$(".top_menu ul").mouseleave(
		function(){
			$(".top_menu ul li").eq(n).addClass("cur")
			$(".top_menu ul li").eq(n).siblings().removeClass("cur")
			$(".top_menu i").stop().animate({left:100},300)
		}
	)
})

// input icon
$(function(){
	$(".text_box>div>div").click(
		function(){
			var n=$(this).index()
			$(".text_box div i img").eq(n).stop().animate({marginTop:-22},100)
		}
	)
	$(".text_box>div input").blur(
		function(){
			$(".text_box div i img").stop().animate({marginTop:0},100)
		}
	)
})


$(function(){
	if(!placeholderSupport()){   // 判断浏览器是否支持 placeholder
	   $('[placeholder]').focus(function() {
	       var input = $(this);
	       if (input.val() == input.attr('placeholder')) {
	           input.val('');
	           input.removeClass('placeholder');
	       }
	   }).blur(function() {
	       var input = $(this);
	       if (input.val() == '' || input.val() == input.attr('placeholder')) {
	           input.addClass('placeholder');
	           input.val(input.attr('placeholder'));
	       }
	   }).blur();
	};
})
function placeholderSupport() {
   return 'placeholder' in document.createElement('input');
}
! function (t) {
    var foothtml = '<div class="top_box">'+
			'<div class="wid_con">'+
				'<div class="top_con">'+
					'<div class="top_logo">'+
					'<img src="images/logo.png"/>'+
					'</div>'+
					'<div class="top_menu">'+
						'<ul>'+
							'<li><a href="#">调查录入</a></li>'+
							'<li><a href="#">填报记录</a></li>'+
							'<li><a href="person.html">个人中心</a></li>'+					
							'<li id="Goout"><a >退出</a></li>'+
						'</ul>'+
					'</div>'+
				'</div>'+
			'</div>'+
		'</div>';
    $("#app").append(foothtml);
    var index = -1;

    if (window.location.href.indexOf('mobile/index') > -1) {
        index = 0;
    }
    if (window.location.href.indexOf('mobile/list') > -1) {
        index = 1;
    }
    if (window.location.href.indexOf('mobile/fuwu') > -1) {
        index = 2;
    }
    if (window.location.href.indexOf('person') > -1) {
        index = 2;
    }
    if (index > -1) {     
        $('.top_menu li').eq(index).addClass('cur')
    }
	setTimeout(function(){
	    $("#Goout").click(function () {
	    	ComFunJS.delToken()
	        window.location.href = "login.html";
	    })		
	},500)	
}(window);